<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<p:dialog id="dialogCadastroTelefones" modal="true" width="40%"
	closable="false" appendTo="@(body)" resizable="false" draggable="false"
	widgetVar="dialogCadastroTelefone" header="Cadastro de Telefones">
	<p:ajax event="close" listener="#{actionBean.close}"
		update="frmDialogTelefone" />
	<h:form id="frmDialogTelefone">
		<h:panelGrid columns="2">
			<h:panelGrid columns="2">
				<h:panelGrid columns="1">
					<p:outputLabel value="DDD:" for="telefone" />
					<p:inputMask id="iptddd" mask="(99)" size="3"
						disabled="#{actionBean.consultando}"
						value="#{actionBean.telefone.ddd}"></p:inputMask>


				</h:panelGrid>
				<h:panelGrid>
					<p:outputLabel value="Telefone:" for="telefone" />
					<p:inputMask id="telefone" required="true"
						requiredMessage="Telefone é obrigatório"
						disabled="#{actionBean.consultando}"
						value="#{actionBean.telefone.tel}" mask="9999-9999?9"
						maxlength="15" />
				</h:panelGrid>
			</h:panelGrid>
			<h:panelGrid>
				<p:outputLabel value="Tipo:"></p:outputLabel>
				<p:selectOneMenu value="#{actionBean.telefone.tipoTelefone}"
					required="true" disabled="#{actionBean.consultando}">
					<f:selectItems var="tipoTel" value="#{actionBean.listaTipoTel}"
						itemLabel="#{tipoTel.descricao}" itemValue="#{tipoTel.id}"></f:selectItems>
				</p:selectOneMenu>
			</h:panelGrid>
		</h:panelGrid>
		<h:panelGrid columns="2">
			<p:commandButton value="Confirma" 
				actionListener="#{actionBean.incluirTel}"
				oncomplete="validaDialog(args,'dialogCadastroTelefone','frmDialogTelefone:dialogCadastroTelefones')"
				update=":frmDialogTelefone,:frm:tbtelefone,:mensagem">
			</p:commandButton>
			<p:commandButton value="Cancela"
				onclick="dialogCadastroTelefone.hide()" immediate="true" />

		</h:panelGrid>

	</h:form>
</p:dialog>

</html>